package cn.iocoder.yudao.module.dr.dal.mysql.sourcecatalog;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.dr.controller.admin.sourcecatalog.vo.SourceCatalogPageReqVO;
import cn.iocoder.yudao.module.dr.dal.dataobject.sourcecatalog.SourceCatalogDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 资源编目 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface SourceCatalogMapper extends BaseMapperX<SourceCatalogDO> {

    default PageResult<SourceCatalogDO> selectPage(SourceCatalogPageReqVO reqVO) {

        LambdaQueryWrapperX query = new LambdaQueryWrapperX<SourceCatalogDO>()
                .eqIfPresent(SourceCatalogDO::getSourceId, reqVO.getSourceId())
                .likeIfPresent(SourceCatalogDO::getAuthorName, reqVO.getAuthorName())
                .likeIfPresent(SourceCatalogDO::getContributeName, reqVO.getContributeName())
                .eqIfPresent(SourceCatalogDO::getAuthorDesc, reqVO.getAuthorDesc())
                .eqIfPresent(SourceCatalogDO::getCatalogTags, reqVO.getCatalogTags())
                .eqIfPresent(SourceCatalogDO::getStatus,reqVO.getStatus())
                .eqIfPresent(SourceCatalogDO::getCatalogClassify, reqVO.getCatalogClassify())
                .eqIfPresent(SourceCatalogDO::getCatalogDesc, reqVO.getCatalogDesc())
                .eqIfPresent(SourceCatalogDO::getCatalogStore, reqVO.getCatalogStore())
                .eqIfPresent(SourceCatalogDO::getWebUrl, reqVO.getWebUrl())
                .eqIfPresent(SourceCatalogDO::getAttach, reqVO.getAttach())
                .eqIfPresent(SourceCatalogDO::getLookUp, reqVO.getLookUp())
                .betweenIfPresent(SourceCatalogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SourceCatalogDO::getId);

        /*if(reqVO.getSourceTypes().equals(1)){
            query.
        }*/
        return selectPage(reqVO, query);
    }

}